<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2016/3/10 0010
 * Time: 13:59
 */
class Plugin_Fenxiao extends Plugin_Core_Base{
    public function on_member_register($params) {
        try {
            $fxcode = Common::session('fxcode');
            if (empty($fxcode))
                return;
            $fenxiao = ORM::factory('fenxiao')->where('memberid', '=', $params['mid'])->find();
            if ($fenxiao->loaded())
                return;
            Model_Fenxiao::invite($params['mid'], $fxcode);
            Common::session('fxcode', null);
        } catch (Exception $excep) {

        }
    }
	
	///以下所有代码 与newtravel/application/classes/plugin/fenxiao.php里完全一样
    public function on_orderstatus_changed($params) {
        try {
            if ($params['status'] == 5) {
                //调用统一的计算方法
                Model_Fenxiao_Commission::pay_commission($params);
            }

        } catch (Exception $excep) {
            echo $excep->getMessage();
        }
    }

}